<template>
<h1>用户：{{ name }}</h1>
<button @click="clickHandle">修改姓名</button>
</template>

<script>
import { reactive, toRef } from 'vue'
export default {
  name: 'App',
  setup() {
    const state = reactive({
      name: '张三',
      age: 19
    })

    let name = toRef(state, 'name')

    const clickHandle = () => {
      console.log(123)
      name.value = '李四'
    }

    return {
      name,
      clickHandle
    }
  }
}
</script>
